package com.maimao.model.order.enums;

import lombok.Getter;

/**
 * @author MaoLin Wang
 * @date 2021/1/18 5:26 下午
 */
@Getter
public enum OrderType {
    /**
     * 普通订单
     */
    NORMAL(1, "普通订单"),

    /**
     * 秒杀订单
     */
    SEC_KILL(2, "秒杀订单"),

    ;

    private Integer status;
    private String msg;

    OrderType(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    OrderType(Integer status) {
        this.status = status;
    }

    public static String getMsgByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (OrderType orderStatus : values()) {
            if (orderStatus.getStatus().equals(code)) {
                return orderStatus.getMsg();
            }
        }
        return null;
    }
}
